#include <iostream>
#include <thread>
#include <utility>

void workFunction(int &x, const std::string &y, std::string &&z)
{
    std::cout << "线程" << std::this_thread::get_id() << "开始执行\n";
    std::cout << "x: " << x << ", y: " << y << ", z: " << z << std::endl;
}

int main()
{
    int x = 42;
    std::string y = "Hello";
    std::string z = "World";

    // 创建线程并传递参数
    std::thread t(workFunction, std::ref(x), y, std::move(z));

    // 修改x的值
    std::cout << "修改x的值为100\n";
    x = 100;

    // 等待线程结束
    t.join();

    return 0;
}